package projbd;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;


public class ProjBD {

    public static void main(String[] args) throws SQLException {
        
        /* Create the connection with Postgres */
        
        try {
            
            Class.forName("org.postgresql.Driver");
            
            Connection connection = null;
            connection = DriverManager.getConnection(
               //"jdbc:postgresql://localhost:5432/test", "postgres", "admin");
               "jdbc:postgresql://localhost:5432/projbd", "postgres", "srx3325");

            
            if(connection != null) {
                System.out.println("CONNECTED !!!");
            }
            
            
            connection.close();
            
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(ProjBD.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(ProjBD.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        /* Parse the input files */
        
        ShakespeareXMLParser parser = new ShakespeareXMLParser();
        
        parser.addFile("input/heuser/t.xml");
        parser.run();
        
    }
}
